package com.example.usercenter.common.base;

import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * Created by zxn on 2017/10/23.
 */
public class ResponseData {
    //请求结果
    private boolean success;
    //消息提示
    private String msg;
    //返回结果
    private Object result;

    public ResponseData(){}

    public ResponseData(boolean success, String msg){
        this.success = success;
        this.msg = msg;
    }

    public ResponseData(boolean success, String msg, Object result){
        this.success = success;
        this.msg = msg;
        this.result = result;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getResult() {
        return result;
    }

    public void setResult(Object result) {
        this.result = result;
    }

    @JsonIgnore
    public static ResponseData ok(String msg){
        return new ResponseData(true, msg);
    }
    @JsonIgnore
    public static ResponseData ok(String msg, Object result){
        return new ResponseData(true, msg, result);
    }
    @JsonIgnore
    public static ResponseData fail(String msg){
        return new ResponseData(false, msg);
    }
}
